<form action="{:sysuri()}" method="post" data-auto="true" class="layui-form layui-card" data-table-id="UserTable">
    <div class="layui-card-body padding-left-40">

        <fieldset>
            <legend><b class="layui-badge think-bg-violet">用户账号</b></legend>
            <div class="layui-row layui-col-space15">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-xs2 text-center">
                        <input type="hidden" name="avatar" value="{$vo.avatar|default=''}">
                        <script>$('[name=avatar]').uploadOneImage();</script>
                    </div>
                    <div class="layui-col-xs5">
                        <label class="block relative">
                            <span class="help-label"><b>登录账号</b>Login Username</span>
                            {if isset($vo) and isset($vo.username)}
                            <input disabled value='{$vo.username|default=""}' required class="layui-input think-bg-gray">
                            {else}
                            <input name="username" value='{$vo.username|default=""}' required pattern="^.{4,}$" placeholder="请输入登录账号" class="layui-input">
                            {/if}
                            <span class="help-block">登录账号不能重复并且创建后不能再次修改哦。</span>
                        </label>
                    </div>
                    <div class="layui-col-xs5">
                        <label class="block relative">
                            <span class="help-label"><b>用户昵称称</b>User Nickname</span>
                            <input name="nickname" value='{$vo.nickname|default=""}' required placeholder="请输入用户名称" class="layui-input">
                            <span class="help-block">用于区分用户数据的用户名称，请尽量不要重复。</span>
                        </label>
                    </div>
                </div>
            </div>
        </fieldset>

        {if !empty($bases) || !empty($authorizes)}
        <fieldset>
            <legend><b class="layui-badge think-bg-violet">用户权限</b></legend>
            {if !empty($bases)}
            <div class="layui-form-item">
                <div class="help-label"><b>角色身份</b>Role Identity</div>
                <div class="layui-textarea help-checks">
                    {foreach $bases as $base}
                    <label class="think-checkbox">
                        {if isset($vo.type) and $vo.type eq $base.id}
                        <input type="radio" checked name="type" value="{$base.id}" lay-ignore>{$base.name}
                        {else}
                        <input type="radio" name="type" value="{$base.id}" lay-ignore>{$base.name}
                        {/if}
                    </label>
                    {/foreach}
                </div>
            </div>
            {/if}
            {if !empty($authorizes)}
            <div class="layui-form-item">
                <div class="help-label"><b>访问权限</b>Role Permission</div>
                <div class="layui-textarea help-checks">
                    {foreach $authorizes as $authorize}
                    <label class="think-checkbox">
                        {if in_array($authorize.id, $vo.authorize)}
                        <input type="checkbox" checked name="authorize[]" value="{$authorize.id}" lay-ignore>{$authorize.title}
                        {else}
                        <input type="checkbox" name="authorize[]" value="{$authorize.id}" lay-ignore>{$authorize.title}
                        {/if}
                    </label>
                    {/foreach}
                </div>
            </div>
            {/if}
        </fieldset>
        {/if}

        <fieldset>
            <legend><b class="layui-badge think-bg-violet">用户资料</b></legend>
            <div class="layui-row layui-col-space15">
                <div class="layui-col-xs4">
                    <label class="relative block">
                        <span class="help-label"><b>姓名</b>Contact Name</span>
                        <input type="text" name="name" value='{$vo.name|default=""}' placeholder="请输入用户姓名" class="layui-input">
                        <span class="color-desc">可选，请填写用户姓名</span>
                    </label>
                </div>
                <div class="layui-col-xs4">
                    <label class="relative block">
                        <span class="help-label"><b>联系邮箱</b>Contact Email</span>
                        <input name="email" pattern="^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$" value='{$vo.email|default=""}' placeholder="请输入联系电子邮箱" class="layui-input">
                        <span class="color-desc">可选，请填写用户常用的电子邮箱</span>
                    </label>
                </div>
                <div class="layui-col-xs4">
                    <label class="relative block">
                        <span class="help-label"><b>联系手机</b>Contact Mobile</span>
                        <input type="tel" maxlength="11" name="phone" value='{$vo.phone|default=""}' pattern="^1[3-9][0-9]{9}$" placeholder="请输入用户联系手机" class="layui-input">
                        <span class="color-desc">可选，请填写用户常用的联系手机号</span>
                    </label>
                </div>
            </div>
            <div class="layui-row layui-col-space15">
                <div class="layui-col-xs3">
                    <label class="relative block">
                        <span class="help-label"><b>公司</b>Contact Company</span>
                        <input type="text" name="company" value='{$vo.company|default=""}' placeholder="请输入用户所属公司" class="layui-input">
                        <span class="color-desc">可选，请填写用户所属公司</span>
                    </label>
                </div>
                <div class="layui-col-xs3">
                    <label class="relative block">
                        <span class="help-label"><b>部门</b>Contact Depart</span>
                        <input type="text" name="depart" value='{$vo.depart|default=""}' placeholder="请输入用户所属部门" class="layui-input">
                        <span class="color-desc">可选，请填写用户所属部门</span>
                    </label>
                </div>
                <div class="layui-col-xs3">
                    <label class="relative block">
                        <span class="help-label"><b>岗位</b>Contact Post</span>
                        <input type="text" name="post" value='{$vo.post|default=""}' placeholder="请输入用户岗位" class="layui-input">
                        <span class="color-desc">可选，请填写用户所属岗位</span>
                    </label>
                </div>
                <div class="layui-col-xs3">
                    <label class="relative block">
                        <span class="help-label"><b>工号</b>Contact JobNo</span>
                        <input type="text" name="job_no" value='{$vo.job_no|default=""}' placeholder="请输入用户工号" class="layui-input">
                        <span class="color-desc">可选，请填写用户工号</span>
                    </label>
                </div>
            </div>
            <label class="layui-form-item block relative margin-top-10">
                <span class="help-label"><b>地址</b>User Remark</span>
                <textarea placeholder="请输入用户地址" class="layui-textarea" name="address">{$vo.address|default=""}</textarea>
            </label>
        </fieldset>

    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>
</form>